package genetic;

import java.awt.Rectangle;

import processing.core.PApplet;
import processing.core.PVector;

public class Obstacle extends PApplet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	Rectangle r;
	PApplet parent;

	public Obstacle(PApplet p, int x, int y, int w, int h) {
		parent = p;
		r = new Rectangle(x, y, w, h);
	}

	public void render() {
		parent.smooth();
		parent.stroke(0);
		parent.fill(175);
		parent.rectMode(CORNER);
		parent.rect(r.x, r.y, r.width, r.height);
	}

	boolean contains(PVector spot) {
		if (r.contains((int) spot.x, (int) spot.y)) {
			return true;
		} else {
			return false;
		}
	}

}